﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace FrmMainForm
{
    public partial class FrmMainForm : Form
    {
        public delegate void ClickEventHandler(string name);
        public event ClickEventHandler ClickEvent;
        public FrmMainForm()
        {
            InitializeComponent();
            timer1.Start();

        }
        

        private void splitContainer2_Panel1_Paint(object sender, PaintEventArgs e)
        {

        }

        private void splitContainer2_Panel2_Paint(object sender, PaintEventArgs e)
        {

        }

        private void splitContainer4_Panel1_Paint(object sender, PaintEventArgs e)
        {

        }

        private void splitContainer4_Panel2_Paint(object sender, PaintEventArgs e)
        {

        }

        private void splitContainer3_Panel1_Paint(object sender, PaintEventArgs e)
        {
                    }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("确定是否退出程序？", "请确认", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
            if (result == DialogResult.Yes)
            {
                System.Environment.Exit(0);//单击后关闭窗口
                
            }
        }

        private void pnlCenter_Paint(object sender, PaintEventArgs e)
        {

        }

        private void label5_Click(object sender, EventArgs e)
        {

        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            DateTime dt = DateTime.Now;//获取当前时间
            lblTime.Text = dt.ToString("HH:mm:ss");//格式化时间
        }

        private void button1_Click(object sender, EventArgs e)
        {
            
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void pnlSlogan_Paint(object sender, PaintEventArgs e)
        {

        }
        public void onLoginChanged(string name)
        {
            labName.Text = "Role:"+ name;
        }

        private void button6_Click(object sender, EventArgs e)
        {
            pnlCenter.Controls.Clear();
            Perform.frmUserM frmUserM = new Perform.frmUserM();
            ClickEvent += frmUserM.onClickEvent;
            ClickEvent(labName.Text.Trim());
            frmUserM.TopLevel = false;
            pnlCenter.Controls.Add(frmUserM);
            frmUserM.Show();
        }

        private void pictureBox2_Click(object sender, EventArgs e)
        {

        }

        private void pnlUserInfor_Paint(object sender, PaintEventArgs e)
        {

        }

        private void button1_Click_1(object sender, EventArgs e)
        {
            pnlCenter.Controls.Clear();
            Perform.frmFlowerManage frmFlowerManage = new Perform.frmFlowerManage();
            frmFlowerManage.TopLevel = false;
            pnlCenter.Controls.Add(frmFlowerManage);
            frmFlowerManage.Show();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            pnlCenter.Controls.Clear();
            Perform.frmResale frmSale = new Perform.frmResale();
            frmSale.TopLevel = false;
            pnlCenter.Controls.Add(frmSale);
            frmSale.Show();

        }

        private void button7_Click(object sender, EventArgs e)
        {
            pnlCenter.Controls.Clear();
            Perform.frmInventory frmIn = new Perform.frmInventory();
            frmIn.TopLevel = false;
            pnlCenter.Controls.Add(frmIn);
            frmIn.Show();
        }

        private void button5_Click(object sender, EventArgs e)
        {
            pnlCenter.Controls.Clear();
            Perform.AboutUs frmIn = new Perform.AboutUs();
            frmIn.TopLevel = false;
            pnlCenter.Controls.Add(frmIn);
            frmIn.Show();
        }

        private void button4_Click(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Minimized;
        }
    }
}
